/**
 *  Date           	Name    		     Change
 *  23/09/2014     	Roy Chan			 Creation
 *
 */
package persistence;

import java.sql.Connection;

import utilities.MessageDeliver;
import utilities.dbConnBase.DBManager;

/**
 * @author Roy Chan
 *
 */
public abstract class DaoBaseClass extends Throwable {
	private static DBManager DBManager;
	private static Connection connection;
	public DaoBaseClass(){
		
	}
	
	public DaoBaseClass(DBManager dbm){
		this.DBManager = dbm;
	}
	
	protected DBManager getDBManager(){
		if(DBManager == null)
		{
			DBManager = new DBManager();
			if(DBManager != null)
				Console("DBManager Established\n");
		}
		
		return DBManager;
	}
	
	protected Connection getConnection(){
		getDBManager();
		
		if(connection == null)
		{
			connection = this.DBManager.getDBConnectionService();
		}
		return connection;
	}
	
//	public DaoServiceBase(DBConBase db){
//		this.getDBConnectionService();
//	}
	
	public void Console(String msg){
		System.out.print(msg);
	}


}
